"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getNewWidgetId = getNewWidgetId;
exports.hasFormDesignLayoutType = void 0;
var _xeUtils = _interopRequireDefault(require("xe-utils"));
var _widgetInfo = require("./widget-info");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
let maxWidgetId = 100000;
function getNewWidgetId(widgetObjList) {
  _xeUtils.default.eachTree(widgetObjList, item => {
    if (item) {
      maxWidgetId = Math.max(maxWidgetId, item.id);
    }
  }, {
    children: 'children'
  });
  return ++maxWidgetId;
}
/**
 * 判断是否布局控件
 */
const hasFormDesignLayoutType = widget => {
  if (widget) {
    const widgetConf = (0, _widgetInfo.getWidgetConfig)(widget.name);
    return widgetConf.group === 'layout';
  }
  return false;
};
exports.hasFormDesignLayoutType = hasFormDesignLayoutType;